﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;

namespace VluSDCEvent
{
    public partial class CtrEventMaster : PortalModuleBase, DotNetNuke.Entities.Modules.IActionable
    {
        string sLanguage;

        protected override void OnPreRender(EventArgs e)
        {
            //if (!Page.ClientScript.IsClientScriptIncludeRegistered("JQueryScript"))
            //{
            //    Page.ClientScript.RegisterClientScriptInclude("jquery", ModulePath + "js/jquery.js");
            //}
            base.OnPreRender(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            // Get language.            
            sLanguage = Controller.MtdGetUrlLanguage(Request, PortalSettings.DefaultLanguage);
            string sCtr = Controller.MtdGetUrlParam(Request, "Ctr");

            // Get params.
            if (sCtr == null)
            {
                Controller.MtdLoadControl(phdNewsMaster, Page, ModulePath, "CtrEventList", sLanguage);
            }
            else
            {
                Controller.MtdLoadControl(phdNewsMaster, Page, ModulePath, sCtr, sLanguage);
            }
        }

        #region Optional Interfaces ***************************************** Begin
        public DotNetNuke.Entities.Modules.Actions.ModuleActionCollection ModuleActions
        {
            get
            {
                sLanguage = Controller.MtdGetUrlLanguage(Request, PortalSettings.DefaultLanguage);
                string sResourceFile = this.LocalResourceFile;
                if (sLanguage.ToLower() == "en-us" || sLanguage.ToLower() == "en-us,en-us")
                    sResourceFile += ".ascx.resx";
                else
                    sResourceFile += ".ascx." + sLanguage + ".resx";

                DotNetNuke.Entities.Modules.Actions.ModuleActionCollection Actions = new DotNetNuke.Entities.Modules.Actions.ModuleActionCollection();
                Actions.Add(GetNextActionID(),
                DotNetNuke.Services.Localization.Localization.GetString(DotNetNuke.Entities.Modules.Actions.ModuleActionType.AddContent, sResourceFile),
                DotNetNuke.Entities.Modules.Actions.ModuleActionType.AddContent,
                "",
                "",
                DotNetNuke.Common.Globals.NavigateURL(TabId, "", "Ctr=CtrEventEdit", "mid=" + this.ModuleId),
                false,
                DotNetNuke.Security.SecurityAccessLevel.Edit,
                true, false);
                return Actions;
            }
        }
        #endregion Optional Interfaces ***************************************** End
    }
}